<?php 

/**
 * @version $Id: router.php,v 1.4 2009/06/04 20:13:37 dgravato Exp $
 * @package    sketchup
 * @subpackage 

 * @author     Chris Borkowski {@link http://www.guggenheim.org}
 * @author     Created on 01-April-2009
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' ); 

function SketchupBuildRoute(&$query)
{
   $segments = array();
   
   if( isset($query['view']) )
   {
      $segments[0] = $query['view'];
      unset( $query['view'] );
   };

   if( isset($query['id']) )
   {
      $segments[1] = $query['id'];
      unset( $query['id'] );
   };

   return $segments;
}

/**
* Method to parse Route
* @param array $segments
*/
function SketchupParseRoute($segments)
{
   $vars = array();
   
   // Get the active menu item.
   $menu   = &JSite::getMenu();
   $item   = &$menu->getActive();

   // Count segments
   $count = count( $segments );

   if (isset($segments[0]) && $segments[0] == 'project')
   {
     	$vars['view']   = 'project';
	 	$vars['id']      = $segments[1];
   }
   if (isset($segments[0]) && $segments[0] == 'all')
   {
      	$vars['view']   = 'all';
     	$vars['id']      = $segments[1];
   }
   if (isset($segments[0]) && $segments[0] == 'search')
   {
      	$vars['view']   = 'search';
     	$vars['id']      = $segments[1];
   }
    
   if (isset($segments[0]) && $segments[0] == 'allearth')
   {
      	$vars['view']   = 'allearth';
      	$vars['id']      = $segments[1];   
   }
   
     if (isset($segments[0]) && $segments[0] == 'vote')
   {
      	$vars['view']   = 'vote';
      	$vars['id']      = $segments[1];   
   }
   
      if (isset($segments[0]) && $segments[0] == 'jury')
   {
      	$vars['view']   = 'jury';
      	$vars['id']      = $segments[1];   
   }

   if (isset($segments[0]) && $segments[0] == 'thanks')
   {
      	$vars['view']   = 'thanks';
      	$vars['id']      = $segments[1];   
   }
return $vars;
}

?>